 # 爬虫入门
# import requests
# import uuid
# import time
# import re
#
# # 发送请求
# url_page = "https://mm.enterdesk.com/dongmanmeinv/"
# ret = requests.get(url=url_page)
#
# url_lst = re.findall('https://up.enterdesk.com/edpic_360_360.*?\.jpg', ret.text)
# for url in url_lst:
#     res = requests.get(url=url)
#     time.sleep(3)
#     # 将响应数据转化为二进制流数据
#     content = res.content
#     name = str(uuid.uuid1()) + ".jpg"
#
#     # 将二进制流数据写入文件
#     with open(name, 'wb') as f:
#         print("正在下载%s" % name)
#         f.write(content)


# 去重
# list1 = []
# list = [1, 2, 1, 3, 5, 5]
#
# for i in list:
#     if i not in list1:
#         list1.append(i)
# print(list1)


# lst = []
# with open('text.txt', 'r', encoding='utf-8') as f:
#     for i in f.readlines():
#         lst_2 = i.split(',')
#         tu = tuple([int(j.strip()) for j in lst_2])
#         lst.append(tu)
# print(lst)
#
# with open('text.txt', 'r', encoding='utf-8') as f:
#     data_list = [tuple([int(j.strip()) for j in i.split(',')]) for i in f.readlines()]
# print(data_list)


# 只出现一次
# lst = [1, 2, 2, 1, 3, 4, 4]
# lst_new = list(set(lst))
#
# for i in lst_new:
#     count = 0
#     for j in lst:
#         if j == i:
#             count += 1
#     if count == 1:
#         print(i)


# 青蛙跳台阶
# def jump(m):
#     if m == 1:
#         return 1
#     if m == 2:
#         return 2
#     if m > 2:
#         return jump(m - 1) + jump(m - 2)
#
#
# print(jump(6))


# 目标和
# def func(lst, target):
#     for i in lst:
#         for j in lst[lst.index(i) + 1:]:
#             if j == target - i:
#                 print(lst.index(i))
#                 print(lst.index(j))
#
#
# func([1, 2, 3, 4, 6, 7], 5)


# 三位数
# def func(lst):
#     total = 0
#     for i in lst:
#         for j in lst:
#             for k in lst:
#                 if i != j and i != k and j != k:
#                     total += 1
#     print(total)
#
#
# func([1, 2, 3, 4])


# 判重
# def func(lst):
#     s = set(lst)
#     return len(lst) == len(s)
#
#
# print(func([1, 2, 3, 5]))